package com.swyc.osschat.Test.StreamTest.Bean;


import com.swyc.osschat.Test.StreamTest.IService.IEnum;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author zhaol@yunrong.cn
 * @version V2.1
 * @since 2.1.0 2019/8/9 15:59
 */
@Getter
@AllArgsConstructor
public enum SpecialityEnum implements IEnum {
    /** 描述 */
    SING("1", "唱歌"),
    DANCE("2","跳舞"),
    RUNNING("3","跑步"),
    SWIMMING("4","游泳")
    ;

    /** 状态码 */
    private String code;

    /** 状态描述 */
    private String description;

    /**
     * 根据编码查找枚举
     *
     * @param code 编码
     * @return {@link SpecialityEnum } 实例
     **/
    public static SpecialityEnum find(String code) {
        for (SpecialityEnum instance : SpecialityEnum.values()) {
            if (instance.getCode()
                .equals(code)) {
                return instance;
            }
        }
        return null;
    }
}